<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="../js/vue.js"></script>
</head>


<!-- 
  1.插槽的基本使用: 组件里面定义 <slot></slot>
  2.插槽的默认值:<slot> button....</slot>
  3.如果有多个值,同时放入到组件进行替换时,它会一起作为替换元素

  
 -->

<body>
  <div id="app">
    <cpn>
      <span slot="center">搜索(替换)</span>
      <button slot="right">按钮(替换)</button>
    </cpn>
  </div>


  <template id="cpn">
    <div>
      <slot name="left"><span>左边</span></slot>
      <slot name="center"><span>中间</span></slot>
      <slot name="right"><span>右边</span></slot>
    </div>
  </template>

  <script>
    var vm = new Vue({
      el: '#app',
      data: {},
      methods: {},
      components: {
        cpn: {
          template: '#cpn'
        }
      }
    });
  </script>
</body>

</html>